#!/bin/bash

# export MSLIBS_SERVER=114.116.244.255

model_build_flag=ON
# model_input_output_flag=ON

export MSLITE_ENABLE_CONVERTER=OFF
# export MSLITE_ENABLE_AVX512=OFF
export MSLITE_ENABLE_AVX=ON

export MSLITE_ENABLE_SERVER_INFERENCE=ON
# export MSLITE_ENABLE_DYNAMIC_THREAD_DISTRIBUTE=OFF
# export MSLITE_ENABLE_SHARING_MODEL_WEIGHT=ON
# export MSLITE_ENABLE_BFC_MEMORY=ON
# export MSLITE_ENABLE_RUNTIME_GLOG=OFF

# export MSLITE_ENABLE_TESTCASES=ON
# export MSLITE_ENABLE_SHARING_MEM_WITH_OPENGL=ON

echo "###################################################### Build Begin ##################################################################"
if [ "${model_build_flag^^}" = "ON" ]; then
    # git stash push
    # git pull --rebase
    # git stash pop

    bash build.sh -I x86_64 -j16 -i 2>&1 | tee build.log

    if [ $? -ne 0 ]; then
        echo "Build mindspore failed"
        echo "###################################################### Build fail ##################################################################"
    else
        echo "Build mindspore succeed"
    fi

    cp build.log ./output
fi

